<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Shops extends Model
{
    
    protected $autoWriteTimestamp = 'datetime';

    // 设置当前模型对应的完整数据表名称
    protected $table = 'shops';

    // 设置字段信息
    protected $schema = [
        'shop_name'             => 'string',
        'shop_code'             => 'string',
        'company_main'          => 'string',
        'shop_status'           => 'boolean',
        'create_time'           => 'datetime',
        'update_time'           => 'datetime'
    ];

    // 设置字段自动转换类型
    protected $type = [
        'update_time'      => 'datetime',
        'create_time'       => 'datetime',
    ];

    // 多个支付渠道
    public function payments()
    {
        return $this->hasMany(ShopsPayments::class, "shop_id", "id");
    }

    // 多种支付方式
    public function methods()
    {
        return $this->hasMany(ShopsPaymentMethods::class);
    }
}
